$(document).ready(function(){
	//Check animation step 1
	var checkItem = '.check-item';
	var wrap = '.block-content';
	checkStyle(checkItem, wrap);
	
	//Check form step 4
	var checkItem = '.form-check-item';
	var wrap = '#client-info-form';
	checkStyle(checkItem, wrap);
	
	// Step position adjust
	var cont = 42;
	$('.step').each(function(index,element){
		var left = cont*(index);
		var layer = $('.step').length - index;
		$(element).css({
			'left': left,
			'z-index': layer
		});
	});
	
	//$('.book-process-block').hide();
	$('.book-step-1').show();
	
	$('.step').click(function(){
		
		$('.numatlast').show();
		$('.numatlast',this).hide();
		switch ($(this).attr('id')) {
			case 'step-1': 	$('#step-1').css({'z-index': 6});
							$('#step-2').css({'z-index': 4});
							$('#step-3').css({'z-index': 3});
							$('#step-4').css({'z-index': 2});
							$('#step-5').css({'z-index': 1});
							$('.book-process-block').hide();
							$('.book-step-1').show();
							break;
							
			case 'step-2':  $('#step-1').css({'z-index': 4});
							$('#step-2').css({'z-index': 6});
							$('#step-3').css({'z-index': 3});
							$('#step-4').css({'z-index': 2});
							$('#step-5').css({'z-index': 1});
							$('.book-process-block').hide();
							$('.book-step-2').show();
							break;
							
			case 'step-3': 	$('#step-1').css({'z-index': 3});
							$('#step-2').css({'z-index': 4});
							$('#step-3').css({'z-index': 6});
							$('#step-4').css({'z-index': 2});
							$('#step-5').css({'z-index': 1});
							$('.book-process-block').hide();
							$('.book-step-3').show();
							break;
							
			case 'step-4': 	$('#step-1').css({'z-index': 2});
							$('#step-2').css({'z-index': 3});
							$('#step-3').css({'z-index': 4});
							$('#step-4').css({'z-index': 6});
							$('#step-5').css({'z-index': 1});
							$('.book-process-block').hide();
							$('.book-step-4').show();
							break;
							
			case 'step-5': 	$('#step-1').css({'z-index': 1});
							$('#step-2').css({'z-index': 2});
							$('#step-3').css({'z-index': 3});
							$('#step-4').css({'z-index': 4});
							$('#step-5').css({'z-index': 6});
							$('.book-process-block').hide();
							$('.book-step-5').show();
							break;
		}
		
	});
	
	//FAQs click
	$('.ques-anws').click(function(){
		$('.anws').slideUp();
		$('.anws',this).slideDown();
		$('.ques-anws').removeClass('expanded');
		$(this).addClass('expanded');
	});
	
});

function checkStyle(checkItem, wrap) {
	$(checkItem, wrap).click(function(){
		console.debug($(this).attr('class').indexOf('checked'));
		if ($(this).attr('class').indexOf('is-checked') == -1) {
			$(this).addClass('is-checked');
		} else {
			$(this).removeClass('is-checked');
		}
	});
}